{% if user.is_authenticated %}
<form id="logoutForm" action="/logout/" method="post" class="navbar-right">
    {% csrf_token %}
    <ul class="nav navbar-nav navbar-right">
        <li><span class="navbar-brand"> 你好 {{ user.first_name }}!</span></li>
        <li><a href="{% url 'homework' %}">作业</a></li>
        <li><a href="{% url 'listquestion' %}">习题</a></li>
        <li><a href="javascript:document.getElementById('logoutForm').submit()">退出</a></li>
    </ul>
</form>

{% else %}

<ul class="nav navbar-nav navbar-right">
    <li><a href="{% url 'login' %}">登录</a></li>
</ul>

{% endif %}
